﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.ThrongIn.BLL;
namespace ThrongIn
{
    public partial class Detail : System.Web.UI.MasterPage
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                 if (Request.QueryString["cid"] != null)
                {
                    Int64 pid = -1;
                    if (Int64.TryParse(Convert.ToString(Request.QueryString["pid"]), out pid))
                    {
                        (new ProfileBLL()).AddProfileVisitLog(pid, IpAddress());  
                    }
                }
                    
            }
        }

        private string IpAddress()
        {

            string strIpAddress;

            strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

            if (strIpAddress == null)

                strIpAddress = Request.ServerVariables["REMOTE_ADDR"];

            return strIpAddress;

        }
    }
}
